package com.vates.vsp.practico.alumnos.service;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.vates.vsp.practico.alumnos.business.Alumno;
import com.vates.vsp.practico.commons.AbstractBaseService;

@Repository("alumnoService")
public class AlumnoServiceImpl extends AbstractBaseService implements AlumnoService {

	/* (non-Javadoc)
	 * @see com.vates.vsp.practico.alumnos.service.AlumnoService#guardar(com.vates.vsp.practico.alumnos.business.Alumno)
	 */
	@Override
	public void guardar(Alumno alumno) {
		this.getHibernateTemplate().saveOrUpdate(alumno);
	}


	/* (non-Javadoc)
	 * @see com.vates.vsp.practico.alumnos.service.AlumnoService#eliminar(com.vates.vsp.practico.alumnos.business.Alumno)
	 */
	@Override
	public void eliminar(Alumno alumno) {
		this.getHibernateTemplate().delete(alumno);
	}


	/* (non-Javadoc)
	 * @see com.vates.vsp.practico.alumnos.service.AlumnoService#getUnAlumno(java.lang.Integer)
	 */
	@Override
	public Alumno getUnAlumno(Integer id) {
		return this.get(Alumno.class, id);
	}


	/* (non-Javadoc)
	 * @see com.vates.vsp.practico.alumnos.service.AlumnoService#getAlumnos()
	 */
	@Override
	public List<Alumno> getAlumnos() {
		List<Alumno> resultado = this.getHibernateTemplate()
				.find("FROM Alumno");
		return resultado;
	}

}
